package me.myqaq.myqaqcraft.slimefunaddon.tasks;

import io.github.thebusybiscuit.slimefun4.api.events.PlayerRightClickEvent;
import io.github.thebusybiscuit.slimefun4.api.items.ItemHandler;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.api.researches.Research;
import io.github.thebusybiscuit.slimefun4.core.attributes.Radioactive;
import io.github.thebusybiscuit.slimefun4.core.attributes.Radioactivity;
import io.github.thebusybiscuit.slimefun4.core.handlers.BlockUseHandler;
import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
import io.github.thebusybiscuit.slimefun4.libraries.commons.lang.ObjectUtils;
import me.myqaq.myqaqcraft.slimefunaddon.MyQaqCraft;
import me.myqaq.myqaqcraft.slimefunaddon.item;
import me.myqaq.myqaqcraft.slimefunaddon.utils.zhu;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.inventory.ItemStack;

import javax.annotation.Nonnull;

public class itemReg {
    public static void  run(){
//        ItemStack[] crazyDG=new ItemStack[]{
//                new ItemStack(Material.EMERALD), null, new ItemStack(Material.EMERALD),
//                SlimefunItems.CARBONADO, SlimefunItems.CARBONADO, SlimefunItems.CARBONADO,
//                new ItemStack(Material.EMERALD), null, new ItemStack(Material.EMERALD)
//        };
//        ItemStack[] crazymineGod=new ItemStack[]{
//                new ItemStack(Material.DIAMOND_AXE), null, new ItemStack(Material.DIAMOND_AXE),
//                SlimefunItems.CARBONADO, SlimefunItems.CARBONADO, SlimefunItems.CARBONADO,
//                new ItemStack(Material  .DIAMOND_AXE), null, new ItemStack(Material.DIAMOND_AXE)
//        };

//        zhu.registerItemAr("QAQ_DG", item.dangaoItem,item.MyQAQ,RecipeType.ENHANCED_CRAFTING_TABLE, crazyDG, new BlockUseHandler() {
//            @Override
//            public void onRightClick(PlayerRightClickEvent event) {
//                event.cancel();
//                int ello = event.getPlayer().getLevel();
//                if (ello >= 30) {
//                    event.getPlayer().giveExpLevels(-30);
//                    event.getPlayer().setFireTicks(5 * 20);
//                    event.getPlayer().sendMessage("§4谁让你摸我的！！！");
//                } else {
//                    event.getPlayer().sendMessage("§4he~呸！30级经验都没有！死~杂~鱼~");
//                    event.getPlayer().setHealth(0);
//                }
//            }
//        }, new ItemUseHandler() {
//            @Override
//            public void onRightClick(PlayerRightClickEvent event) {
//                event.getPlayer().giveExpLevels(1);
//                event.getPlayer().sendMessage("§a给你一点经验。偷着乐吧");
//            }
//        });
//
//        // 雷神之锤数据 里面直接绑定事件
//        zhu.registerItem("MINE_GOD", item.mine_god, item.MyQAQ,RecipeType.ENHANCED_CRAFTING_TABLE, crazymineGod, new ItemUseHandler() {
//            @Override
//            public void onRightClick(PlayerRightClickEvent e) {
//                if (e.getClickedBlock().isPresent()){
//                    Block b = e.getClickedBlock().get();
//                    World w =b.getWorld();
//                    Location loc=b.getLocation();
//                    w.strikeLightningEffect(loc);
//                    e.getPlayer().sendMessage("§c我tm来拉~~");
//                }
//            }
//        });

        // 创建一个研究
        Research xpCake = new Research(new NamespacedKey(MyQaqCraft.getInstance(), "QAQ_DG"),182201,"好吃好玩的蛋糕",30);
        xpCake.addItems(SlimefunItem.getByItem(item.dangaoItem),SlimefunItem.getByItem(item.mine_god));
        xpCake.register();
    }
}
